from pydantic import BaseModel
from typing import Any, Optional

from src.enums.exception import ExceptionEnum

class VersionResponse(BaseModel):
    version: str
    release_date: str

class ResponseModel(BaseModel):
    code: str
    msg: Optional[str] = None
    data: Optional[Any] = None


def response_ok(data: Optional[Any] = None) -> ResponseModel:
    return ResponseModel(
        code="E0000",
        msg="Success",
        data=data
    )

def response_error(error: ExceptionEnum, data:Optional[Any] = None) -> ResponseModel:
    return ResponseModel(
        code=error.code,
        msg=error.msg,
        data=data
    )